import Vue from 'vue'
import Vuex from 'vuex'
import user from '@/store/modules/user'
import getters from './getters'

Vue.use(Vuex)

const store = new Vuex.Store({
	state: {
		amapInfo: {
			hasOpen: true,
			hasClose: false,
			openTime: null,
			closeTime: null,
			lunaAmap: null, //插件对象
			myInterval: 60, //定位间隔，单位秒
			sucCount: 0, // 持续定位成功次数
			errCount: 0, // 持续定位失败次数
			isValid: false,
			userId: 0,
			dev_no:'',
			phonenumber:'',
			altitude: 0,
			longitude: 0,
			latitude: 0,
			speed: 0,
			angle: 0,
			power: 0,
			accuracy: 0,
			address: '',
			gpsTime: '',
			satellites:0,
			network:0,
			locateType:0
		}
	},
	mutations: {
		setAmapInfo(state, info) {
			state.amapInfo = info;
			uni.setStorage({ //将用户信息保存在本地
				key: 'amapInfo',
				data: info
			})
		},
	},
	modules: {
	  user
	},
	getters
})

export default store

